home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9901 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.8 KB

  1. Path: sunrise.gv.ssi1.com!news
  2. From: Mike Palmer <Mike.Palmer@tus.ssi1.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: How to shrink your Windows program by %80!
  5. Date: 5 Mar 1996 02:51:47 GMT
  6. Organization: Silicon Systems, Inc.
  7. Message-ID: <4hga83$65t@atlas.tus.ssi1.com>
  8. References: <4hau9d$m3@newsbf02.news.aol.com>
  9. NNTP-Posting-Host: pc259u.tus.ssi1.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
  14.  
  15. champalber@aol.com (Champalber) wrote:
  16. >How is that possable? Convert it to Pascal.
  17. >
  18. >Does anybody use Turbo Pascal (TP) for Windows? Having used only
  19. >BorlandC++ (BC) for Windows for the past few years, I was amazed to see
  20. >how much faster TP compiled and how much smaller the resulting code was.
  21. >If you have these two products try out a simple experiment: Write the
  22. >"hello world. program for Windows" with each compiler, then look and see.
  23. >
  24. >When I compiled with TP I thought that the compilation had stopped on an
  25. >error, but no, it was just _very_ fast. In my particular case I wrote a
  26. >very simple program to write a few lines of text in a window; a simple
  27. >task that I wanted to spend as little time writing as possible, so I used
  28. >OWL for BC, and the equivilent for TP.
  29.  
  30. I used TP for DOS for a while, and generally found that the code produced
  31. was small, and the compiler was blindingly fast. I've still never seen
  32. anything like it in terms of speed.
  33.  
  34. >
  35. >The size comparison: BC - 90k,    TP - 14k!
  36. >The two programs do _exactly_ the same thing.
  37. >
  38. >What is surprising is that both compilers are written by Borland, and the
  39. >Windows stuff in Pascal is very similar to the C++ version - same Windows
  40. >functions, same sequence of functions.
  41. >
  42. >Why does one compiler seem to be so much more efficient than the other?
  43. >There is always the argument that "you get all the C++ goodies", but using
  44. >TP you can do just about everything that you can do in BC, with seamingly
  45. >increadable savings on final exe size.
  46. >
  47. >Richard Champalbert
  48. >champalber@aol.com
  49. >
  50.  
  51. But, the reason I switched to C was that Pascal wanted to type things
  52. too strongly. Maybe I just never really understood Pascal, or how to 
  53. get around the problems, but it seemed like I always found myself 
  54. trying to pass a variable sized array into some function that would 
  55. operate on the data. Pascal, however, always wanted me to pass in
  56. some kind of "Array of 1 to 500 of type X", which pretty much drove
  57. me nuts. For a data plotting program like I was trying to write, the
  58. size of the array was indeterminate, and would only be determined 
  59. when the program was run. In many cases, the same function would be 
  60. called with several different sized arrays during the course of one
  61. run. Like I said, maybe I never discovered the secret, but I read 
  62. several books trying to find the answer, and could never find one
  63. that fully satisfied me.
  64.  
  65. A second reason was that there was an accepted standard for C when I
  66. switched, and there was no widely accepted standard for Pascal. That
  67. meant that when I programmed on my workstation, it was a (significantly)
  68. different Pascal than on my PC. Boy did I ever wish that Borland had
  69. produced compilers for workstations!!!
  70.  
  71. So, for me, C was a refreshing change, and C++ has enough advantages 
  72. in its organizational structures that I have now switched to that.
  73.  
  74. I don't really like the code bloat that I seem to be stuck with, but
  75. the coding advantages (at least for now) outweigh the problems. 
  76.  
  77. BUT: If Pascal works for you, go for it! Even though it didn't work
  78. for me, it was for some pretty specific reasons. Overall, I didn't 
  79. mind the strong type checking in Pascal, and I never had the kind of
  80. memory and boundary problems that I have been plagued with in C 
  81. ever since I switched. 
  82.  
  83. And, of course, thanks for making your files smaller - it leaves
  84. more room for my bloated C++ exe's :-) !!!
  85.  
  86.  
  87. -- Mike --
  88.  
  89.